class Solution(object):
    def longestPalindrome(self, s):
        """
        :type s: str
        :rtype: int
        """
        res = 0
        matchCounter = {}
        for c in s:
            if c not in matchCounter:
                matchCounter[c] = 1
            else:
                if matchCounter[c] == 1:
                    res += 2
                    matchCounter[c] = 0
                else:
                    matchCounter[c] = 1

        if res < len(s):
            res += 1

        return res
        
s = Solution()
print(s.longestPalindrome("abccccdd"))

